package com.sunxd.rule.judge.spi;

import com.sunxd.rule.judge.beans.param.Condition;
import org.springframework.stereotype.Component;

import java.util.function.Function;

/**
 * @author sun.xd
 * @description: description
 * @date 2024/10/22 11:44
 */
@Component
public class MyselfJudge extends AbstractCustomerJudge {
    @Override
    public Function<Condition, Boolean> doJudge() {
        return condition -> {
            String left = condition.getLeft().toString();
            int right = Integer.parseInt(condition.getRight().toString());
            return left.length() > right;
        };
    }

    @Override
    public String invokeKey() {
        return "judgeNameLength1";
    }
}
